                                                                <include file="Public/head"/>
<style>
    .shop_details ul li span .menHover {background: #20ab4f;color: #fff;}
    .menDao a {background: #cecece;color: #303030;padding: 0 10px;text-align: center;height: 24px;line-height: 24px;cursor: pointer;}
    .account {width: 90%;float: left;}
    .account .accountCurrent {background-color: #33CCFF;color: #fff9f9;}
    .account ul {padding: 0px;}
    .account ul li {width:300px;margin: 0;padding: 10px 0;border-radius: 5px;border: 1px solid #E4E4E4;float: left;background: #e4e4e4;}
    .account ul > li:not(:first-child) { margin-left: 4%;}
    .account ul li:hover {cursor: pointer;}
    .account ul li div {width: 100%;clear: both;}
    .account ul li span {height: 25px;line-height: 25px;display: block;width: auto;}
    .account ul li .span_right {text-align: right;width: 30%;}
    #acount_info{padding-top:20px;font-size:12px;}

</style>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css"/>
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="jybggl.wycl"/>
    <div class="mianR">
        <div class="listBox">
            <h3 class="cha">违约车辆详情</h3>
            <div class="car_info">
                <div class="car_no"><span style="font-size:14px;">车辆编号：<b>{$detail.sno}</b></span></div>
                <if condition="$detail.status neq 3"> <!-- 其他渠道成交时，不显示车主信息 -->
                    <table border="1" width="100%">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>车主信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">车主类型</td>
                            <td width="39%">{$detail.owner_type_name}</td>
                            <if condition="$detail.owner_type eq 1">
                                <td width="11%" style="color:#898b8a;">车主姓名</td>
                                <td width="39%">{$detail.seller_name}</td>
                                <else />
                                <td width="11%" style="color:#898b8a;">公司名称</td>
                                <td width="39%">{$detail.seller_name}</td>
                            </if>
                        </tr>
                        <tr>
                            <if condition="$detail.owner_type eq 1">
                                <td width="11%" style="color:#898b8a;">联系电话</td>
                                <td colspan="3">{$detail.seller_phone}</td>
                                <else />
                                <td width="11%" style="color:#898b8a;">联系人姓名</td>
                                <td width="39%">{$detail.contact_person}</td>
                                <td width="11%" style="color:#898b8a;">联系电话</td>
                                <td width="39%">{$detail.seller_phone}</td>
                            </if>
                        </tr>
                        </tbody>
                    </table>
                </if>



                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>评估师信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">评估师姓名</td>
                        <td width="39%">{$detail.checker_name}</td>
                        <td width="11%" style="color:#898b8a;">评估师电话</td>
                        <td width="39%">{$detail.checker_phone}</td>
                    </tr>
                    </tbody>
                </table>


                <if condition="$detail.status eq 3"> <!-- 其他渠道成交，显示单据信息 -->
                    <notempty name="detail.mid">
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>单据信息</span></td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">订单号</td>
                                <td width="39%">{$detail.d_order_no}</td>
                                <td width="11%" style="color:#898b8a;">订单状态</td>
                                <td width="39%">
                                    {$detail.d_order_info.status_name}
                                </td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">采购单号</td>
                                <td width="39%">{$detail.purchase_order_nu}</td>
                                <td width="11%" style="color:#898b8a;">变更单号</td>
                                <td width="39%">{$change_order_data.modify_no}</td>
                            </tr>
                            </tbody>
                        </table>
                    </notempty>

                </if>


                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                            <span>车辆信息</span>
                            <span style="float: right;margin-right: 20px;"><a
                                    style="color: #0000FF;text-decoration: underline;"
                                    href="/Car/report/car_id/{$detail.car_id}" target="_blank">检测报告</a></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车型</td>
                        <td width="39%">{$detail.model}</td>
                        <td width="11%" style="color:#898b8a;">排放标准</td>
                        <td width="39%">{$detail.emission}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">初登日期</td>
                        <td>{$detail.first_reg_date}</td>
                        <td style="color:#898b8a;">颜色</td>
                        <td>{$detail.car_color}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">表显里程</td>
                        <td>{$detail.pointer_mileage}万公里</td>
                        <td style="color:#898b8a;">车况级别</td>
                        <td>{$detail.composite_state}{$detail.accident_level}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">车辆注册地</td>
                        <td>{$detail.first_reg_city}</td>
                        <td style="color:#898b8a;">车架号</td>
                        <td>{$detail.vin}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">过户限制</td>
                        <td>{$detail.transfer_limit_str}</td>
                        <td style="color:#898b8a;">车牌号</td>
                        <td>{$detail.plate_prefix}{$detail.plate_suffix}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">渠道来源</td>
                        <td>
                            <if condition="$detail.comefrom neq ''">
                                <?php if(empty($detail['comefrom_url'])):?>
                                {$detail.comefrom}
                                <?php else: ?>
                                <a href="{$detail.comefrom_url}" target="_blank" rel="noreferrer">{$detail.comefrom}</a>
                                <?php endif;?>
                                <else/>
                                未知
                            </if>
                        </td>
                        <td style="color:#898b8a;">所在地</td>
                        <td>{$detail.location_area}</td>
                    </tr>
                    </tbody>
                </table>

                <!--<if condition="$detail.pay_status gt 0">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                                <span>
                                   付款信息({$detail.pay_status_name})
                                </span>
                            </td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">付款人</td>
                            <td width="39%">
                                {$detail.pay_man}
                            </td>
                            <td width="11%" style="color:#898b8a;">付款时间</td>
                            <td width="39%">
                                {$detail.pay_time}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </if>-->

                <if condition="$detail.status eq 0">
                    <notempty name="detail.mid"> <!-- 如果有变更单-->
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>变更信息</span>
                                </td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">变更单号</td>
                                <td width="39%">{$change_order_data.modify_no}</td>
                                <td width="11%" style="color:#898b8a;">变更原因</td>
                                <td width="39%">{$change_order_data.modify_reason}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">变更单状态</td>
                                <td>{$change_order_data.status}</td>
                                <td style="color:#898b8a;">变更时间</td>
                                <td>{$change_order_data.createtime}</td>
                            </tr>
                            <tr>
                                <td> <!--or ($change_order_data['modify_reason'] eq '')-->
                                    <?php if($change_order_data['dealer_compensate'] != 0):?>
                                        赔付金额
                                    <?php else: ?>
                                        违约扣款
                                    <?php endif; ?>
                                </td>
                                <td>{$change_order_data['dealer_compensate'] != 0 ? $change_order_data['dealer_compensate'] : $change_order_data['dealer_deduction']}</td>
                                <td></td>
                                <td></td>
                            </tr>
                            </tbody>
                        </table>
                    </notempty>
                </if>

                <if condition="$detail.status eq 2">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>拍卖信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">拍卖结束时间</td>
                            <td width="39%">{$detail.bidding_end_time}</td>
                            <td width="11%" style="color:#898b8a;">拍卖最高价</td>
                            <td width="39%">{:format_money($detail['highest_price'])}元</td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">保留价</td>
                            <td width="39%">{:format_money($detail['reserve_price'])}元</td>
                            <td width="11%" style="color:#898b8a;">
                                <if condition="$detail.is_consult eq 1">磋商成交价</if>
                                <if condition="$detail.is_consult eq 0">确认成交价</if>
                            </td>
                            <td width="39%">{:format_money($detail['highest_price'] + $detail['company_subsidies'])}元
                            </td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">公司补贴</td>
                            <td width="39%">{$detail.company_subsidies} 元</td>
                            <td width="11%" style="color:#898b8a;"></td>
                            <td width="39%"></td>
                        </tr>
                        </tbody>
                    </table>
                </if>

                <if condition="$detail.status eq 3"> <!-- 其他渠道成交 -->
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>成交车商信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">车商联系人</td>
                            <td width="39%">{$detail.dealer_name}</td>
                            <td width="11%" style="color:#898b8a;">联系人电话</td>
                            <td width="39%">{$detail.dealer_phone}</td>
                        </tr>
                        <tr>
                           <!-- <td width="11%" style="color:#898b8a;">车商收购价</td>
                            <td width="39%">{:format_money($detail['trade_price'])} 元</td>-->
                            <td width="11%" style="color:#898b8a;">提车人</td>
                            <td colspan="3" width="89%">{$detail.take_car_man}</td>
                        </tr>
                        </tbody>
                    </table>

                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>交易信息</span></td>
                            </tr>
                            <tr>
                                <td>成交价格</td>
                                <td>{$detail.trade_price}元</td>
                                <td>成交时间</td>
                                <td>{$detail.deal_time}</td>
                            </tr>
                            <tr>
                                <td>交付服务费</td>
                                <td>{$detail.transfer_fee}元</td>
                                <td>收款单号</td>
                                <td><?php echo $collection_payment_data['collectionCarData']['collection_no'];?></td>
                            </tr>
                            <tr>
                                <td>应收款</td>
                                <td colspan="3"><?php echo $detail['trade_price'] + $detail['transfer_fee']; ?>元</td>
                            </tr>
                        </tbody>
                    </table>

                </if>

                <if condition="$detail.status eq 2"> <!-- 退车 -->
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>退车信息</span></td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">类型</td>
                                <td width="39%">
                                   收付类型
                                </td>
                                <td>金额</td>
                                <td>备注</td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">车款</td>
                                <td width="39%">已付</td>
                                <td width="11%" style="color:#898b8a;">{$first_payment_data.amount}元</td>
                                <td width="39%">{$detail.remark_amount_of_car}</td>
                            </tr>
                            <!--判断付款还是赔款-->
                            <if condition="$detail.back_reason eq 1">
                                <tr>
                                    <td width="11%" style="color:#898b8a;">赔付车主</td>
                                    <td width="39%">付款</td>
                                    <td width="11%" style="color:#898b8a;">{$detail.compensate}元</td>
                                    <td width="39%">{$detail.remark_payment}</td>
                                </tr>
                            <elseif condition="$detail.back_reason eq 2"/>
                                <tr>
                                    <td width="11%" style="color:#898b8a;">车主违约金</td>
                                    <td width="39%">收款</td>
                                    <td width="11%" style="color:#898b8a;">{$detail.compensate}元</td>
                                    <td width="39%">{$detail.remark_payment}</td>
                                </tr>
                            </if>

                        </table>
                        <div style="font-size: 16px;text-align: right; height: 42px;line-height: 42px;margin-bottom: -10px;color: #303030;padding-right: 10px;">
                            <?php if($detail['back_reason'] == 1):?>
                                <?php $result = $first_payment_data['amount'] - $detail['compensate'];?>
                                <?php if($result > 0):?>
                                    应收车款：<span><?php echo $result;?>元</span>
                                <?php else:?>
                                    应付车款：<span><?php echo $detail['compensate'] - $first_payment_data['amount'];?>元</span>
                                <?php endif;?>
                            <?php endif;?>
                            <if condition="$detail.back_reason eq 2">
                                应收车款：<span><?php echo $first_payment_data['amount'] + $detail['compensate'];?>元</span>
                            <elseif condition="$detail.back_reason eq 3"/>
                                应收车款：<span><?php echo $first_payment_data['amount'];?>元</span>
                            </if>
                        </div>

                        <table border="1" width="100%" style="margin-top:10px;">
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>备注信息</span></td>
                            </tr>
                            <tr>
                                <td width="10%">退车备注</td>
                                <td colspan="3">{$detail.remark}</td>
                            </tr>
                        </table>
                </if>

               <!-- <if condition="$detail.compensate_type eq 1">
                    <empty name="detail.mid">
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tbody>
                                <tr>
                                    <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>争议信息（我方违约）</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="11%" style="color:#898b8a;">仲裁员</td>
                                    <td width="39%">{$detail.emp_name}</td>
                                    <td width="11%" style="color:#898b8a;">仲裁时间</td>
                                    <td width="39%">{$detail.createtime}</td>
                                </tr>
                                <tr>
                                    <td style="color:#898b8a;">补偿车商金额</td>
                                    <td>{$detail.cut_down_price}</td>
                                    <td style="color:#898b8a;">备注</td>
                                    <td>{$detail.issue_remark}</td>
                                </tr>
                            </tbody>
                        </table>
                    <else/>

                    </empty>

                </if>-->

                <if condition="$detail.status eq 2 AND ($detail.car_source eq 1 AND $detail['bank_account'] neq '')">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>打款信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">开户银行</td>
                            <td width="39%">{$detail.bank_name}</td>
                            <td width="11%" style="color:#898b8a;">银行帐号</td>
                            <td width="39%">{$detail.card_no}</td>
                        </tr>
                        <tr>
                            <td style="color:#898b8a;">账户名</td>
                            <td colspan="3">{$detail.account_name}</td>
                        </tr>
                        </tbody>
                    </table>
                </if>

                <!-- 退车类型 旧数据展示 2016-12-13 之前-->
                <!--<if condition="$detail.compensate_type eq 2">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>争议信息（车商违约）</span>
                            </td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">仲裁员</td>
                            <td width="39%">{$detail.emp_name}</td>
                            <td width="11%" style="color:#898b8a;">仲裁时间</td>
                            <td width="39%">{$detail.createtime}</td>
                        </tr>
                        <tr>
                            <td style="color:#898b8a;">扣除车商金额</td>
                            <td>{$detail.cut_down_price}</td>
                            <td style="color:#898b8a;">备注</td>
                            <td>{$detail.issue_remark}</td>
                        </tr>

                        </tbody>
                    </table>
                </if>-->

                <!--平台确认失败备注-->
                <!--<if condition="$detail.breach_type eq 1">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>备注信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">平台确认备注</td>
                            <td width="89%">{$detail.platform_confirm_remark}</td>
                        </tr>
                        </tbody>
                    </table>
                </if>-->

                <?php if ($detail['status'] == 1): ?>
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>重拍信息</span></td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">报告处理方式</td>
                                <td width="39%">
                                    <if condition="$detail['report_type'] eq 1">
                                        重新检测
                                    <else/>
                                        原报告
                                    </if>
                                <td width="11%" style="color:#898b8a;">重拍单号</td>
                                <td width="39%">{$detail['order_no']}</td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">原保留价</td>
                                <td width="39%">{:format_money($detail['order_info']['reserve_price'])}元</td>
                                <td width="11%" style="color:#898b8a;">现保留价</td>
                                <td width="39%">{:format_money($detail['reserve_price'])}元</td>
                            </tr>
                            <tr>
                                <td>重拍备注</td>
                                <td colspan="3">{$detail.remark}</td>
                            </tr>
                            </tbody>
                        </table>
                <?php endif ?>

                <?php if ($detail['status'] == 3): ?>
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>备注信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">其他渠道备注</td>
                        <td width="39%">{$detail.remark}</td>
                    </tr>
                    </tbody>
                </table>
                <?php endif ?>
            </div>
        </div>
        <if condition="$detail.status lt 1">
            <h3 class="yonghu">请选择车辆处理结果</h3>
            <input type="hidden" name="mid" value="{$detail.mid}">
            <div class="yuyue">
                <ul>
                    <li class="yuCurrent">重拍</li>
                    <li>退车</li>
                    <li>其他渠道成交</li>
                </ul>
            </div>
            <div class="listBox">
                <div class="yuList">
                    <div class="shop_details">
                        <ul>
                            <li>
                                <span>保留价</span>
                                <em>
                                    <input id="reserve_price" type="text" name="reserve_price"
                                           value="{$detail.reserve_price}" placeholder="请输入保留价"/> 元
                                </em>
                            </li>
                            <li>
                                <span>报告处理方式</span>
                                <span class="menDao" id="treatment">
                                    <a href="javascript:void(0);" onclick="$('#is_re_check').val(0);" class="menHover">原报告</a>
                                    <a href="javascript:void(0);" onclick="$('#is_re_check').val(1);" >重新检测</a>
                                </span>
                                <input type="hidden" id="is_re_check" name="is_re_check"  value="0"/>
                            </li>
                            <div class="rechck_status" style="display: none">
                                <li>
                                    <span>预约时间</span>
                                    <input type="text" id="reserve_time" name="reserve_time" class="xiaci" value="" placeholder="请选择预约时间" readonly="true">
                                </li>
                                <li>
                                    <span>预约门店</span>
                                    <div class="detailed" style="display: block;">
                                        <select id="reserve_store" name="reserve_store" style="width:150px;">
                                            <option value="0">请选择门店</option>
                                            <?php foreach($stores as $key=>$vs):?>
                                            <option value="{$key}">{$vs}</option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                </li>
                            </div>
                            <li>
                                <span>备注</span>
                                <textarea id="cp_remark" class="remarks_text"></textarea>
                            </li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input type="button" data-id="1" value="确定" class="queding">
                        <input type="button" onclick="history.back();" class="quxiao" value="返回">
                    </div>
                </div>
                <div class="yuList" style="display: none;">
                    <div class="shop_details">
                        <ul>
                            <li>
                                <span>退车原因</span>
                                <span class='menDao1' id="treatment1">
                                    <a href="javascript:void(0);" onclick="$('#payment_reason').val(1);" class="menHover">平台失误</a>
                                    <a href="javascript:void(0);" onclick="$('#payment_reason').val(2);">卖方违约</a>
                                    <a href="javascript:void(0);" onclick="$('#payment_reason').val(3);">平退</a>
                                </span>
                                <input type="hidden" id="payment_reason" name="payment_reason" value="1"/>
                            </li>
                            <li>
                                <div class="reasons">
                                    <div class="reasons-list">
                                        <table>
                                            <thead>
                                            <tr><td width="20%">类型</td><td width="20%">收付类型</td><td width="20%">金额</td><td width="40%">备注</td></tr>
                                            </thead>
                                            <tbody>
                                            <tr>
                                                <td>车款</td>
                                                <td>收款</td>
                                                <td>
                                                    <notempty name="first_payment_data">
                                                        <i class="receivables-money">{$first_payment_data.amount}</i>元
                                                    <else/>
                                                        <i class="receivables-money">0</i>元
                                                    </notempty>
                                                </td>
                                                <td>
                                                    <textarea name="remark_amount_of_car"></textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>赔付车主</td>
                                                <td>付款</td>
                                                <td>
                                                    <span>
                                                        <input type="text" value="" name="payment_amount" class="paragraph"><label>元</label>
                                                    </span>
                                                </td>
                                                <td>
                                                    <textarea name="remark_payment"></textarea>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        <div class="receivable-money"><i>应收车款</i>：<span></span>元</div>
                                        <if condition="$detail.car_source eq 1">
                                            <div class="playMoney clearfix">
                                                <span>打款账号</span>
                                                <input type="hidden" name="account_id" id="account_id_new" value="">
                                                <input type="hidden" name="bank_name" id="bank_name_new" value="">
                                                <input type="hidden" name="card_no" id="card_no_new" value="">
                                                <input type="hidden" name="account_name" id="account_name_new" value="">

                                                <volist name="fours_bank_account" id="fba" key="k">
                                                    <table>
                                                        <tbody>
                                                        <tr><td width="25%" class="play-number">打款帐号{$k}</td><td></td></tr>
                                                        <tr><td width="25%" class="play-number">开户银行：</td><td class="bank_name">{$fba.bank_name}</td></tr>
                                                        <tr><td width="25%" class="play-number">银行账号：</td><td class="card_no">{$fba.card_no}</td></tr>
                                                        <tr><td width="25%" class="play-number">账户名：</td><td class="account_name">{$fba.account_name}</td></tr>
                                                        </tbody>
                                                    </table>
                                                </volist>
                                            </div>
                                        </if>
                                    </div>

                                    <div class="reasons-list" style="display: none;">
                                        <table>
                                            <thead>
                                            <tr><td width="20%">类型</td><td width="20%">收付类型</td><td width="20%">金额</td><td width="40%">备注</td></tr>
                                            </thead>
                                            <tbody>
                                            <tr>
                                                <td>车款</td>
                                                <td>收款</td>
                                                <td>
                                                    <notempty name="first_payment_data">
                                                        <i class="receivables-money">{$first_payment_data.amount}</i>元
                                                        <else/>
                                                        <i class="receivables-money">0</i>元
                                                    </notempty>
                                                <td>
                                                    <textarea name="owner_remark_amount_of_car"></textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>违约金</td>
                                                <td>收款</td>
                                                <td>
                                                    <span><input type="text" value="" name="owner_payment_amount" class="paragraph"><label>元</label></span>
                                                </td>
                                                <td>
                                                    <textarea name="owner_remark_payment"></textarea>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        <div class="receivable-money">应收车款：<span></span>元</div>
                                    </div>

                                    <div class="reasons-list" style="display: none;">
                                        <table>
                                            <thead>
                                            <tr><td width="20%">类型</td><td width="20%">收付类型</td><td width="20%">金额</td><td width="40%">备注</td></tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td>应收车款</td>
                                                    <td>收款</td>
                                                    <td>
                                                        <notempty name="first_payment_data">
                                                            <i class="receivables-money">{$first_payment_data.amount}</i>元
                                                        <else/>
                                                            <i class="receivables-money">0</i>元
                                                        </notempty>
                                                    </td>
                                                    <td>
                                                        <textarea name="normal_remark_amount_of_car"></textarea>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <div class="receivable-money">应收车款：<span></span>元</div>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <span>备注</span>
                                <textarea id="refund_remark_new" class="remarks_text"></textarea>
                            </li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input data-id="2" type="button" value="确定" class="queding">
                        <input type="button" onclick="history.back();" class="quxiao" value="返回">
                    </div>
                </div>
                <div class="yuList" style="display: none;">
                    <div class="shop_details">
                        <ul>
                            <li>
                                <span>成交价</span>
                                <em><input id="trade_price" type="text" name="trade_price" value=""
                                           placeholder="请输入成交价"></em>
                            </li>
                            <li>
                                <span>交付服务费</span>
                                <em><input id="transfer_fee" type="text" name="transfer_fee" value=""
                                           placeholder="请输入交付服务费"></em>
                            </li>
                            <li>
                                <span>车商联系人</span>
                                <em><input id="dealer" type="text" name="dealer" value="" placeholder="请输入车商联系人"></em>
                            </li>
                            <li>
                                <span>联系人电话</span>
                                <em><input id="dealer_phone" type="text" name="dealer_phone" value=""
                                           placeholder="请输入车商电话"></em>
                            </li>
                            <li>
                                <span>提车人</span>
                                <em><input id="take_car_man" type="text" name="take_car_man" value=""
                                           placeholder="请输入提车人"></em>
                            </li>

                            <li>
                                <span>备注</span>
                                <textarea id="trade_remark" class="remarks_text"></textarea>
                            </li>
                        </ul>
                    </div>
                    <div class="yongBtn">
                        <input data-id="3" type="button" value="确定" class="queding">
                        <input type="button" onclick="history.back();" class="quxiao" value="返回">
                    </div>
                </div>
            </div>
            <else/>
            <div class="yongBtn1">
                <input type="button" onclick="window.close();" class="quxiao" value="关闭">
            </div>
        </if>
    </div>
    <div class="clear"></div>
</div>
<script>
    $(".menDao a").click(function () {
        $(".menDao a").removeClass("menHover");
        $(this).addClass("menHover");
        var back_method = $('#back_method').val();
        if (back_method == 1) {
            $('#buchang').show();
            $('#dakuan').show();
            $('#kouchu').hide();
        } else if (back_method == 2) {
            $('#buchang').hide();
            $('#dakuan').hide();
            $('#kouchu').show();
        }
        // var index = $(".menDao a").index(this);
        // $(".xuanzhe ul li .store1 .detailed").eq(index).show().siblings().hide();
    });

    $(document).ready(function () {
        //打款账号
        initAccount();
        $('.account ul li').on('click', function () {
            $(".account ul li").removeClass("accountCurrent");
            $(this).addClass("accountCurrent");

            $("input[name='account_id']").val($(this).attr('data-id'));
            $("input[name='bank_name']").val($(this).attr('data-bank-name'));
            $("input[name='card_no']").val($(this).attr('data-card-no'));
            $("input[name='account_name']").val($(this).attr('data-account-name'));
        });

        $('.reasons .playMoney table').on('click', function () {
            $('.reasons .playMoney table').removeClass("accountCurrent");
            $(this).addClass("accountCurrent");

            $("input[name='bank_name']").val($(this).find(".bank_name").html());
            $("input[name='card_no']").val($(this).find(".card_no").html());
            $("input[name='account_name']").val($(this).find(".account_name").html());
        });

        function initAccount() {
            var accountObj = $(".account ul li");
            var fid = "{$detail.fid}";
            var countAccount = accountObj.length;
            if (countAccount < 2) { //如果是一个账号时，让自动选中
                accountObj.addClass('accountCurrent');
                $("input[name='account_id']").val(accountObj.attr('data-id'));
                $("input[name='bank_name']").val(accountObj.attr('data-bank-name'));
                $("input[name='card_no']").val(accountObj.attr('data-card-no'));
                $("input[name='account_name']").val(accountObj.attr('data-account-name'));

            }

            var accountObj =  $('.reasons .playMoney table');
            var countAccount = accountObj.length;
            if (countAccount < 2) { //如果是一个账号时，让自动选中
                $('.reasons .playMoney table').addClass("accountCurrent");
                $("input[name='bank_name']").val($(".bank_name").html());
                $("input[name='card_no']").val($(".card_no").html());
                $("input[name='account_name']").val($(".account_name").html());
            }
        }

        $(".driving_time").ymdateplugin({
            showTimePanel: true,
            changeMonth: true,
            changeYear: true
        });

        $(".transfer em").click(function () {
            $(".yuList ul .transfer em").removeClass("active");
            $("#transfer_limit").val($(this).attr('data-id'));
            $(this).addClass("active");
        })

        $(".queding").click(function () {
            var status = $(this).attr('data-id');
            var url = '';
            var postData = {
                "car_id": "<?php echo $detail['car_id'];?>",
                "order_id": "<?php echo $detail['order_id'] ?>",
                "owner_id": "<?php echo $detail['owner_id'] ?>",
                "bc_id": "<?php echo $detail['bc_id'] ?>"
            };
            if (status == 1) {
                var is_re_check = $('#is_re_check').val(); //是否重新检测
                postData.is_re_check = is_re_check; // 查看是否重新检测
                if(is_re_check != 0){ // 如果选择了 重新检测，就要传递相应的预约时间和预约门店
                    var reserve_time = $('#reserve_time').val(); //预约时间
                    if(!reserve_time){
                        shibai_alert('请选择预约时间');
                        return;
                    }
                    postData.reserve_time = reserve_time; // 预约时间
                    var reserve_store = $('#reserve_store').val(); //预约门店
                    if(reserve_store == 0){
                        shibai_alert('请选择门店');
                        return;
                    }
                    postData.reserve_store = reserve_store; // 预约门店
                }

                url = '/BreachCar/re_auction';
                postData.reserve_price = $("#reserve_price").val();
                if (postData.reserve_price <= 0) {
                    shibai_alert("请输入正确的保留价");
                    return;
                }
                // postData.transfer_limit = $("#transfer_limit").val();
                // if(postData.transfer_limit==''){
                //     shibai_alert("请选择过户限制");
                //     return;
                // }
                postData.remark = $("#cp_remark").val();
            } else if (status == 2) {
                url = '/BreachCar/refund';
                var mid = $("input[name='mid']").val();
                postData.mid = mid;
                /*if(mid != 0){ //如果是新数据的话，就走新的流程*/
                    var payment_reason = $("input[name='payment_reason']").val();
                    postData.payment_reason = payment_reason;

                    if(payment_reason == 1 || payment_reason == 2){ //平台违约或者卖方违约

                        if(payment_reason == 1){ //平台违约
                            postData.payment_amount = $("input[name='payment_amount']").val();
                            postData.remark_amount_of_car = $("textarea[name='remark_amount_of_car']").val();
                            postData.remark_payment = $("textarea[name='remark_payment']").val();
                        }
                        if(payment_reason == 2){ //卖方违约
                            postData.payment_amount = $("input[name='owner_payment_amount']").val();
                            postData.remark_amount_of_car = $("textarea[name='owner_remark_amount_of_car']").val();
                            postData.remark_payment = $("textarea[name='owner_remark_payment']").val();
                        }
                        if(postData.payment_amount < 0 || postData.payment_amount == ''){
                            shibai_alert('输入金额不正确');
                            return;
                        }
                    }else{ //平退
                        postData.payment_amount = 0;
                        postData.remark_amount_of_car = $("textarea[name='normal_remark_amount_of_car']").val();
                    }
                    var car_source = "{$detail.car_source}";
                    var pay_status = "{$detail.pay_status}";
                    var  first_payment_amount = "{$first_payment_data.amount}";
                    if(payment_reason == 1){ //如果是平台失误
                        if (car_source == 1 ) {
                            if(first_payment_amount - postData.payment_amount < 0){ //如果首付款金额 - 赔付金额 < 0 就需要付款，要选择打款账号
                                //判断是否选中打款帐号
                                if (!$('.reasons .playMoney table').hasClass('accountCurrent')) {
                                    shibai_alert('请选择打款账号');
                                    return;
                                };
                                postData.account_id = $("#account_id_new").val();
                                postData.bank_name = $("#bank_name_new").val();
                                postData.card_no = $('#card_no_new').val();
                                postData.account_name = $("#account_name_new").val();
                            }
                        }
                    }
                    postData.refund_remark = $('#refund_remark_new').val();
                    postData.compensate = postData.payment_amount;
                /*}else{
                    postData.compensate = $("#compensate").val();
                    if (postData.compensate < 0) {
                        shibai_alert("请输入正确的价格");
                        return;
                    }
                    var compensate_type = "{$detail.compensate_type}";
                    if (compensate_type == 1) {
                        postData.back_method = $("#back_method").val();
                    }
                    var car_source = "{$detail.car_source}";
                    var pay_status = "{$detail.pay_status}";
                    if (car_source == 1 && pay_status < 2) {
                        //判断是否选中打款帐号
                        if (!$(".account ul li").hasClass('accountCurrent')) {
                            shibai_alert('请选择打款账号');
                            return;
                        };
                        postData.account_id = $("#account_id").val();
                        postData.bank_name = $("#bank_name").val();
                        postData.card_no = $('#card_no').val();
                        postData.account_name = $("#account_name").val();
                    }
                    postData.refund_remark = $("#refund_remark").val();
                    if (postData.refund_remark == '') {
                        shibai_alert("请输入退车原因");
                        return;
                    }
                }*/
                console.log(postData);
            } else if (status == 3) {
                url = '/BreachCar/other_channel_deal';
                postData.trade_price = $("#trade_price").val();
                if (postData.trade_price <= 0) {
                    shibai_alert("请输入正确的成交价");
                    return;
                }

                postData.transfer_fee = $('#transfer_fee').val();
                if (postData.transfer_fee < 0) {
                    shibai_alert("请输入正确的交付服务费");
                    return;
                }

                postData.dealer = $("#dealer").val();
                if (postData.dealer == '') {
                    shibai_alert("请输入车商联系人");
                    return;
                }
                postData.dealer_phone = $("#dealer_phone").val();
                if (postData.dealer_phone == '') {
                    shibai_alert("请输入联系人电话");
                    return;
                }
                postData.take_car_man = $("#take_car_man").val();
                if (postData.take_car_man == '') {
                    shibai_alert("请输入提车人");
                    return;
                }
                postData.remark = $("#trade_remark").val();
            } else {
                shibai_alert("状态错误");
                return;
            }
            var btn = $(this);
            btn.attr("disabled", "disabled").css({
                "background": "#999",
                "border": "none",
                "color": "#fff"
            }).val("提交中...");
            $.post(url, postData, function (data) {
                if (data.code != 200) {
                    shibai_alert(data.msg, 1500);
                    btn.removeAttr("disabled style").val("确定");
                    return false;
                }
                btn_alert("操作成功", 1500, function () {
                    window.location.href = "/BreachCar/index";
                });
            }, 'json');

        });

        $("#reserve_store").select2();

        $("#reserve_time").ymdateplugin({
            showTimePanel: true,
            changeMonth: true,
            changeYear: true,
            gotoCurrent: true,
            ampm: true
        });
    });

    $(function(){
        $("#treatment a").eq(1).click(function(){
            $(".rechck_status").show();
        })
        $("#treatment a").eq(0).click(function(){
            $(".rechck_status").hide();
        })

        $("#treatment1 a").click(function(){
            $("#treatment1 a").removeClass("menHover");
            $(this).addClass("menHover");
            var index=$("#treatment1 a").index(this);
            $(".reasons .reasons-list").eq(index).show().siblings().hide();
        })

        $(".receivable-money span").each(function(i){
            var receivables=parseInt($(".receivables-money").eq(i).html());
            $(".receivable-money span").eq(i).html(receivables)
        })

        $(".paragraph").each(function(i){
            $(this).keyup(function(){
                var payment_reason = $("input[name='payment_reason']").val();
                //alert(payment_reason);
                $(this).val($(this).val().replace(/\D/g,''));
                var receivables=parseInt($(".receivables-money").eq(i).html());
                var first_payment_amount = '{$first_payment_data.amount}'; //首付款单
                var oInput=parseInt($(this).val());
                if(payment_reason == 2){ //如果是卖方违约,那么收款金额就是首付款单金额 + 赔付金额
                    if($(this).val()==""){
                        oInput = 0;
                    }
                    $(".receivable-money span").eq(i).html(Math.abs(first_payment_amount * 1 + oInput * 1));
                }else{
                    if($(this).val()==""){
                        oInput = 0;
                        $(".receivable-money").eq(i).find("span").html(first_payment_amount - oInput);
                    }
                    if((first_payment_amount - oInput) <0) {
                        $(".receivable-money span").eq(i).html(Math.abs(first_payment_amount - oInput));
                        $(".playMoney").show();
                        $(".receivable-money").eq(i).find("i").html("应付金额");
                    } else {
                        $(".receivable-money span").eq(i).html(Math.abs(first_payment_amount - oInput));
                        $(".playMoney").hide();
                        $(".receivable-money").eq(i).find("i").html("应收车款");

                    }
                }
            })
        })
    })
</script>
<include file="Public/foot"/>